package com.blb.permission_ms.controller;

import com.blb.permission_ms.entity.Permission;
import com.blb.permission_ms.entity.ResponseResult;
import com.blb.permission_ms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/user-permission-menus/{username}")
    public ResponseResult<List<Permission>> getUserPermissionMenus(@PathVariable String username){
        List<Permission> menus = userService.getPermissionMenuByUsername(username);
        return ResponseResult.ok(menus);
    }
}
